fix build with old bytestring
authorJoey Hess <joeyh@joeyh.name>
Fri, 21 Feb 2025 19:34:23 +0000 (15:34 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 21 Feb 2025 19:34:23 +0000 (15:34 -0400)
bytestring-0.11.3.0 is the first to have ShortByteString singleton.
Unsure about what version added concat, but mconcat = concat.

Annex/Locations.hs

index 77b761b6de02d7d55377c9df223e385514900622..7cc52d96881ff70884e675fec267c3372aa8b0f5 100644 (file)
@@ -745,7 +745,7 @@ keyFile :: Key -> OsPath
 keyFile k = 
        let b = serializeKey'' k
        in toOsPath $ if SB.any (`elem` needesc) b
-               then SB.concat $ map esc (SB.unpack b)
+               then mconcat $ map esc (SB.unpack b)
                else b
   where
        esc w = case chr (fromIntegral w) of
@@ -753,7 +753,7 @@ keyFile k =
                '%' -> "&s"
                ':' -> "&c"
                '/' -> "%"
-               _ -> SB.singleton w
+               _ -> SB.pack [w]
 
        needesc = map (fromIntegral . ord) ['&', '%', ':', '/']